package com.urbanski.clipboard.client.action;

import java.io.IOException;
import com.urbanski.clipboard.client.ClipboardClient;
import com.urbanski.clipboard.client.threads.ClipboardListener;
import com.urbanski.clipboard.client.util.ClientConstants.ClientCommand;

public class ExitActionHandler extends ClientActionHandler
{

	public ExitActionHandler(String[] tokens)
	{
		super(ClientCommand.EXIT, tokens);
	}

	@Override
	public void execute() throws IOException
	{
		ClipboardClient.disconnectAll();
		
		ClipboardListener clipboardListener = ClipboardClient.getClipboardListener();
		
		if (clipboardListener != null)
		{
			clipboardListener.stop();
		}
	}

}
